
package com.app.bimo.module_accounts.mvp.model.model;


import com.app.bimo.commonbusiness.BuildConfig;
import com.app.bimo.commonbusiness.bean.BaseResult;
import com.app.bimo.commonbusiness.network.RetrofitServiceManager;
import com.app.bimo.commonbusiness.util.DataUtil;
import com.app.bimo.library_db.UserData;
import com.app.bimo.module_accounts.mvp.constract.PreferenceNextContract;
import com.app.bimo.module_accounts.mvp.model.api.service.AccountService;
import com.app.bimo.module_accounts.mvp.model.entiy.TagData;
import com.app.bimo.module_accounts.mvp.model.entiy.TagResult;

import java.util.List;

import io.reactivex.Observable;

public class PreferenceUserNextModel implements PreferenceNextContract.Model {


    @Override
    public void onDestroy() {

    }


    @Override
    public Observable<BaseResult<TagResult>> getTags(int page, int pageSize, String tagName) {
        if (DataUtil.isEmpty(tagName)) {
            return RetrofitServiceManager.getInstance().createRetrofit(BuildConfig.APPLICATION_ID, AccountService.class).getTags(page, pageSize);

        }else {
            return RetrofitServiceManager.getInstance().createRetrofit(BuildConfig.APPLICATION_ID, AccountService.class).getTags(page, pageSize, tagName);

        }


    }



    @Override
    public Observable<BaseResult<String>> setTags(String tagids) {
        return RetrofitServiceManager.getInstance().createRetrofit(BuildConfig.APPLICATION_ID, AccountService.class).setTags(tagids);
    }

    @Override
    public Observable<BaseResult<List<TagData>>> getUsedTags() {
        return RetrofitServiceManager.getInstance().createRetrofit(BuildConfig.APPLICATION_ID, AccountService.class).getUsedTags();
    }
    @Override
    public Observable<BaseResult<Object>> setPre(int channel, String categoryids) {
        return RetrofitServiceManager.getInstance().createRetrofit(BuildConfig.APPLICATION_ID, AccountService.class).setPre(channel,categoryids,0);

    }
    @Override
    public Observable<BaseResult<UserData>> getUserInfo() {
        return RetrofitServiceManager.getInstance().createRetrofit(BuildConfig.APPLICATION_ID, AccountService.class).getUserInfo();

    }

}
